{% load adminmedia admin_list real_estate_app_list graph_tags i18n %}

  {{ block.super }}
  
  {% if cl.formset or action_form %}
    {% url admin:jsi18n as jsi18nurl %}
    <script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
  {% endif %}
  {{ media }}
  <style type="text/css">
  {% if not actions_on_top and not actions_on_bottom %}
      #changelist table thead th:first-child {width: inherit}
  {% endif %}
    /* Property list photos custom */
    .media > ul.thumbnails {
      margin-bottom: 0;
      margin-top: 0;
    }
    .media [class*="span"] {
      margin-left: 0;
    }

    /* This is custom for tooltip photos of realtor */
    [rel="tooltip"]:hover {
      cursor: pointer;
    }
    .tooltip-inner ul.thumbnails {
      margin-right: 10px;
    }
    .tooltip-inner ul.thumbnails li {
      margin: 0;
    }
  </style>
  
 <script type="text/javascript">
  (function($){
    $(document).ready(function(){
      $('#changelist-form').tooltip({
        selector: "[rel=tooltip]",
        container: 'body'
      });
    });
  })(jQuery);
 </script>
{% if action_form %}{% if actions_on_top or actions_on_bottom %}
<script type="text/javascript">
(function($) {
    $(document).ready(function($) {
        $("tr input.action-select").actions();
    });
})(django.jQuery);
</script>
{% endif %}{% endif %}
{% if has_add_permission or has_change_permission %}
  <div class="content_title">
    {% if title %}<h4 class="span8">{{ title }}</h4>{% endif %}
    {% if has_add_permission %}
    <div class="offset7 text-right add_tags">
      <div class="btn-group">
        <a title="{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}" 
           {% if is_popup %} href="{{ app_label }}/{{ object_name|lower }}/add/?_popup=1" {% else %} href="{{ app_label }}/{{ object_name|lower }}/add/" {% endif %} 
           class="btn btn-primary">
          <i class="icon-plus icon-white"></i>
          {% if not is_popup %}
            {% blocktrans with cl.opts.verbose_name as name %}{{ name }}{% endblocktrans %}
          {% else %}
            {% blocktrans %}Add{% endblocktrans %}
          {% endif %}
        </a>
      </div>
    </div>
    {% endif %}
  </div>
        <div class="row-fluid content_template_tags">
          
            <div class="span9">
                {% block object-tools %}{% endblock %}
                {% if cl.formset.errors %}
                    <div class="alert alert-error">
                    {% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
                    </div>
                    {{ cl.formset.non_form_errors }}
                {% endif %}
                <div class="widget-header-no-hieght">
                  {% block search %}{% search_form cl %}{% endblock %}
                </div>
                <div class="widget-header-no-hieght visible-desktop">
                  {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
                </div>
                <form id="changelist-form" action="/admin/{{ app_label }}/{{ object_name|lower }}/" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %}>{% csrf_token %}
                  {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
                  {% if cl.formset %}
                    {{ cl.formset.management_form }}
                  {% endif %}
                  <div class="widget widget-table">          
                  {% block result_list %}
                      <div class="widget-header-no-hieght">
                      {% if action_form and actions_on_top and cl.full_result_count %}{% admin_actions %}{% endif %}
                      </div>
                      <div class="widget-content">
                      {% include "admin/propertys/property/change_list_results.html" %}
                      {% if action_form and actions_on_bottom and cl.full_result_count %}{% admin_actions %}{% endif %}
                      </div>
                  {% endblock %}
                  {% block pagination %}{% pagination cl %}{% endblock %}
                  </div>
                </form>
                
            </div>

            {% if cl.has_filters %}
              <div class="span3 container real_apps">
                <div class="nav-collapse collapse visible-desktop">
                  <div class="widget">
                      <div class="widget-header">
                        <i class="icon-filter"></i><h3 id="filter">{% trans 'Filter' %}</h3>
                      </div>
                      <div id="changelist-filter-content" class="widget-content">
                        {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
                      </div>
                  </div>
                </div>
              </div>
            {% endif %}
        </div>
{% else %}
  <h4> {% trans "Permission denied for property change list" %} </h4>
{% endif %}